package com.company.designmode.create.single;

/**
 * 懒汉式+不加Sync锁的单例模式-线程不安全,在多线程不能正常工作
 */
public class LazySingletonNoSync {
    private static LazySingletonNoSync instance;

    private LazySingletonNoSync() {
    }

    public static LazySingletonNoSync getInstance() {
        if (instance == null) {
            instance = new LazySingletonNoSync();
        }
        return instance;
    }

    public void showMessage(){
        System.out.println("Hello World!");
    }

}
